package cn.com.czpb.client.module.personal.adapter;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import cn.com.czpb.client.R;
import cn.com.czpb.client.model.usercenter.MyInviteBean;

/**
 * Created by Administrator on 2017/12/4.
 */

public class MyInviteAdapter extends BaseMultiItemQuickAdapter<MyInviteBean,BaseViewHolder> {
    private Context context;
    public MyInviteAdapter(List<MyInviteBean> list, Context context){
        super(list);
        this.context = context;
        addItemType(1,R.layout.item_invite_list);
    }

    @Override
    protected void convert(BaseViewHolder helper, MyInviteBean item) {
        Glide.with(context).load(item.getAvatar_path()).into((ImageView) helper.getView(R.id.user_img));
        helper.setText(R.id.user_name,item.getNickname());
        helper.setText(R.id.invite_time,item.getInvitcode_time());
    }

//    public View getView(int position, View convertView, ViewGroup parent) {
//        ViewHolder holder;
//        if(convertView == null){
//            convertView = LayoutInflater.from(context).inflate(R.layout.item_invite_list,null);
//            holder = new ViewHolder();
//            holder.user_img = convertView.findViewById(R.id.user_img);
//            holder.user_name = convertView.findViewById(R.id.user_name);
//            holder.invite_time = convertView.findViewById(R.id.invite_time);
//            convertView.setTag(holder);
//        }else{
//            holder = (ViewHolder) convertView.getTag();
//        }
//        Glide.with(context).load(list.get(position).getUser_img()).into(holder.user_img);
//        holder.user_name.setText(list.get(position).getUser_name());
//        holder.invite_time.setText(list.get(position).getCreate_time());
//        return convertView;
//    }
//    class ViewHolder{
//        CircleImageView user_img;
//        TextView user_name;
//        TextView invite_time;
//    }
}
